<template>
	<view><uni-indexed-list :options="list" :showSelect="false" @click="chooseCity"></uni-indexed-list></view>
</template>

<script>
import uniIndexedList from '@/components/uni-indexed-list/uni-indexed-list.vue';
import cityData from '@/common/city.js';
import { mapState, mapMutations } from 'vuex';
export default {
	computed:{
		...mapState(['cityMap'])
	},
	components: { uniIndexedList },
	data() {
		return {
			list: cityData.citys
		};
	},
	methods: {
		...mapMutations(['setCityMap','setCityInfo']),
		chooseCity(e) {
			if(this.cityMap.size<1){
				let city = cityData.getCtiyInfo();
				this.setCityMap(city);
			}
			this.setCityInfo(e.item);
			uni.navigateBack({
				delta:1
			});
		}
	}
};
</script>

<style></style>
